From: Jasper St. Pierre Date: Tue, 3 Dec 2013 23:08:42 +0000 (-0500) Subject: background: Clarify the intent of the code X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~3018 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5262a4161993e50d046a0c770b52413ac9c36015;p=gnome-shell.git background: Clarify the intent of the code Stomping on local variables and trying to keep loop state isn't too fun. Just use a new variable here so we aren't too confused with what we're doing. https://bugzilla.gnome.org/show_bug.cgi?id=719803 --- diff --git a/js/ui/background.js b/js/ui/background.js index 79e58a7f0..1d9f55c8a 100644 --- a/js/ui/background.js +++ b/js/ui/background.js @@ -183,13 +183,16 @@ const BackgroundCache = new Lang.Class({ for (let j = 0; j < pendingLoad.callers.length; j++) { if (pendingLoad.callers[j].onFinished) { - if (content && pendingLoad.callers[j].shouldCopy) { - content = object.copy(pendingLoad.callers[j].monitorIndex, - pendingLoad.callers[j].effects); + let newContent; + if (content && pendingLoad.callers[j].shouldCopy) { + newContent = content.copy(pendingLoad.callers[j].monitorIndex, + pendingLoad.callers[j].effects); + } else { + newContent = content; } - pendingLoad.callers[j].onFinished(content); + pendingLoad.callers[j].onFinished(newContent); } }